package com.example.springvue.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.example.springvue.common.annotation.LogAnnotation;
import com.example.springvue.common.handler.AdminUserHeaderHodler;
import com.example.springvue.common.handler.NotExistException;
import com.example.springvue.common.returnthrow.Result;
import com.example.springvue.common.returnthrow.ResultStatus;
import com.example.springvue.model.AdminUser;
import com.example.springvue.model.AdminUserHeader;
import com.example.springvue.model.AuthGroup;
import com.example.springvue.model.AuthRule;
import com.example.springvue.service.AdminUserService;
import com.example.springvue.service.AuthGroupService;
import com.example.springvue.service.AuthRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.*;


@Controller
public class Admin {


    @Autowired
    AdminUserService adminUserService;
    @Autowired
    AuthGroupService authGroupService;
    @Autowired
    AuthRuleService authRuleService;
//
//
//    @RequestMapping("/admin/userInfo")
//    @ResponseBody
//    @LogAnnotation(module = "用户模块",operator = "获取登录用户信息")
//    public Result<AdminUser> queryUserList(){
//        AdminUser adminUser = AdminUserHeaderHodler.get();
//        return Result.success("请求成功",adminUser);
//    }
//
//
//    @RequestMapping("/admin/getMenu")
//    @ResponseBody
//    @LogAnnotation(module = "用户模块",operator = "获取登录用户信息的菜单")
//    public Result<List<Map< String, Object>>> getMenu(){
//        AdminUser adminUser = AdminUserHeaderHodler.get();
//        AuthGroup authGroup = authGroupService.getAuthGroupInfoId(adminUser.getGroupId());
//        List<Map< String, Object >> authRule = authRuleService.getAuthRuleList(null);
//        List<Map< String, Object >> wdadaw = new ArrayList<>();
//        for (int i = 0; i < authRule.size(); i++) {
//            Map< String, Object > info = authRule.get(i);
//            String id = String.valueOf((Long) info.get("id"));
//            List<Map< String, Object >> children = authRuleService.getAuthRuleListTwo(id);
//            info.put("children",children);
//            System.out.println(children);
//            wdadaw.add(info);
//        }
//        return Result.success("请求成功",wdadaw);
//    }

}
